<?php
$aksi="module/mahasiswa/aksi.php";
switch($_GET[act]){
  // Tampil Berita
  default:
?>
<h2>Input Proposal</h2>
<?php echo "<input type=button value='Input Proposal' onclick=\"window.location.href='?mod=inputproposal&act=inputproposal';\">"; ?>
<table width="490" >
  <tr >
    <th width="20">No</th>
    <th width="144">npk</th>
    <th width="150">Nama</th>
    <th width="156">Aksi</th>
  </tr>
 <?php 
 
 	$p      = new Paging;
    $batas  = 5;
    $posisi = $p->cariPosisi($batas);
 
 		$sql="SELECT
					proposal_skripsi.npk,
					proposal_skripsi.id_proposal,
					mahasiswa.nama
					FROM
					mahasiswa
				Inner Join proposal_skripsi ON proposal_skripsi.npk = mahasiswa.npk ORDER BY 	                proposal_skripsi.id_proposal DESC LIMIT $posisi,$batas ";

 		$query=@mysql_query($sql);
	$no=1 + $posisi;
		while ($data=@mysql_fetch_array($query)){
  ?>
   <tr class="<?php if ($no %2 == 0):echo "zebra";else:echo "zebra2"; endif;?>" align="center">
    <td><?php echo $no; ?></td>
    <td><?php echo $data['npk']; ?></td>
    <td><?php echo $data['nama']; ?></td>
     <td align="center"><a href=?mod=inputproposal&act=editproposal&id=<?php echo "$data[id_proposal]"; ?>>Edit </a>| 
     <?php echo "<a href=$aksi?mod=inputproposal&act=hapus&id=$data[id_proposal]>"; ?>Hapus</a> </td>
  </tr>
  
 <?php 
 $no++;
 } ?>
</table>
<center><?php 
    $jmldata = mysql_num_rows(mysql_query("SELECT * FROM slide"));
    $jmlhalaman  = $p->jumlahHalaman($jmldata, $batas);
    $linkHalaman = $p->navHalaman($_GET[halaman], $jmlhalaman);

    echo "<div id=paging>$linkHalaman</div><br>";
break;
  case "inputproposal":
  ?>
  <h2>Input Proposal Mahasiswa</h2>
<?php echo "
  <form method=POST action='$aksi?mod=inputproposal&act=input' enctype='multipart/form-data'>"; 
 
  ?>
  <table width="420" >
    <tr>
      <td width="79">NO</td>
    
      <td width="329"><input type=text name='jurusan' value="Prodi S1 Akt"  readonly="readonly" size=10>
       				  <input type=text name='kampus' value=" STEI " readonly="readonly" size=4></select>
			<select name="no_bulan" style="width:70px">
			<option value="I">Jan</option>
			<option value="II">Feb</option>
			<option value="III">Mar</option>
			<option value="IV">Apr</option>
			<option value="V">Mei</option>
			<option value="VI">Jun</option>
			<option value="VII">Jul</option>
			<option value="VIII">Ags</option>
			<option value="IX">Sep</option>
			<option value="X">Okt</option>
			<option value="XI">Nov</option>
			<option value="XII">Des</option>
			</select><select name="no_tahun" style="width:72px">
			<?PHP
			$tahun = 2000; 
			while ($tahun!=date('Y') + 1){
			echo "<option>$tahun</option>";
			$tahun++;
			}
			?>
	  </select></td>
    </tr>
    <tr>
      <td width="79">NIP Dosen</td>
    
      <td width="329"><?PHP
					
			echo"<select name='nip'>";
          $tampil=@mysql_query("SELECT nip,nama FROM dosen ORDER BY nip");
          if ($r[kode_jurusan]==0){
            echo "<option value=0 selected>- Pilih Kategori -</option>";
          }   

          while($w=mysql_fetch_array($tampil)){
            if ($r[nip]==$w[nip]){
              echo "<option value=$w[nip] selected>$w[nama]</option>";
            }
            else{
              echo "<option value=$w[nip]>$w[nama]</option>";
            }
          }
		 

    echo "</select>";
			
		
			?>
	   </select></td>
    </tr>
     <tr>
      <td width="79">NPK Mahasiswa</td>
    
      <td width="329"><input type=text name='npk'  size=15> </td>
    </tr>
     <tr>
      <td width="79">Judul</td>
    
      <td width="329"><textarea name="judul"  style="width:500px"></textarea></td>
    </tr>
     <tr>
      <td width="79">IPK</td>
    
      <td width="329"><input type=text name='ipk' size=5> </td>
    </tr>
    <tr>
      <td width="79">Bidang</td>
    
      <td width="329"><input type=text name='bidang' size=14> </td>
    </tr>
     <tr>
      <td width="79">Masa Bimbingan</td>
    
      <td width="329">Dari &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="db_tanggal" style="width:50px">
			<?PHP
			$tanggal = 1; #tanggal awal 1
			while ($tanggal!=32){ #ketika value dari $tanggal tidak sama dengan 32 maka lakukan perulangan sampai ke 32
			echo "<option>$tanggal</option>"; #memunculkan tanggal dari 1 - 31
			$tanggal++; #munculkan  tanggal di form
			}
			?>
			</select>
			<select name="db_bulan" style="width:70px">
			<option value="01">Jan</option>
			<option value="02">Feb</option>
			<option value="03">Mar</option>
			<option value="04">Apr</option>
			<option value="05">Mei</option>
			<option value="06">Jun</option>
			<option value="07">Jul</option>
			<option value="08">Ags</option>
			<option value="09">Sep</option>
			<option value="10">Okt</option>
			<option value="11">Nov</option>
			<option value="12">Des</option>
			</select>
			<select name="db_tahun" style="width:72px">
			<?PHP
			$tahun = 2000;
			while ($tahun!=date('Y') + 1){
			echo "<option>$tahun</option>";
			$tahun++;
			}
			?>
	  </select> / <br /> 
	  sampai dengan: 
	  <select name="sb_tanggal" style="width:50px">
			<?PHP
			$tanggal = 1;
			while ($tanggal!=32){
			echo "<option>$tanggal</option>"; 
			$tanggal++; 
			}
			?>
			</select>
			<select name="sb_bulan" style="width:70px">
			<option value="01">Jan</option>
			<option value="02">Feb</option>
			<option value="03">Mar</option>
			<option value="04">Apr</option>
			<option value="05">Mei</option>
			<option value="06">Jun</option>
			<option value="07">Jul</option>
			<option value="08">Ags</option>
			<option value="09">Sep</option>
			<option value="10">Okt</option>
			<option value="11">Nov</option>
			<option value="12">Des</option>
			</select>
			<select name="sb_tahun" style="width:72px">
			<?PHP
			$tahun = 2000;
			while ($tahun!=date('Y') + 1){
			echo "<option>$tahun</option>";
			$tahun++;
			}
			?>
	  </select></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type=submit value=Simpan>
                            <input type=button value=Batal onclick=self.history.back()></td>
    </tr>
  </table>
</form>
  
<?php break; 
 case "editproposal":
 ?>
 <h2>Edit Proposal Mahasiswa</h2>
 <?php echo "
  <form method=POST action='$aksi?mod=inputproposal&act=update' enctype='multipart/form-data'>"; 
			$data=@mysql_query("select * from proposal_skripsi where id_proposal=$_GET[id]");
			$r=@mysql_fetch_array($data);  
  ?>
  <table width="420" >
    <tr>
      <td width="79">NO</td>
    <?php $no=substr($r['no_stdps'],0,4);?>
      <td width="329"><input type=text name='no' value="<?=$no;?>" readonly="readonly" size=4>
      				  <input type=text name='jurusan' value="Prodi S1 Akt"  readonly="readonly" size=10>
       				  <input type=text name='kampus' value=" STEI " readonly="readonly" size=4></select>
			<select name="no_bulan" style="width:70px">
			<option value="I">Jan</option>
			<option value="II">Feb</option>
			<option value="III">Mar</option>
			<option value="IV">Apr</option>
			<option value="V">Mei</option>
			<option value="VI">Jun</option>
			<option value="VII">Jul</option>
			<option value="VIII">Ags</option>
			<option value="IX">Sep</option>
			<option value="X">Okt</option>
			<option value="XI">Nov</option>
			<option value="XII">Des</option>
			</select><select name="no_tahun" style="width:72px">
			<?PHP
			$tahun = 2000; 
			while ($tahun!=date('Y') + 1){
			echo "<option>$tahun</option>";
			$tahun++;
			}
			?>
	  </select></td>
   
    </tr>
    <tr>
      <td width="79">NIP Dosen</td>
    
      <td width="329"><?PHP
					
			echo"<select name='nip'>";
 			
          $tampil=@mysql_query("SELECT nip,nama FROM dosen ORDER BY nip");
          if ($r[kode_jurusan]==0){
            echo "<option value=0 selected>- Pilih Kategori -</option>";
          }   

          while($w=mysql_fetch_array($tampil)){
            if ($r[nip]==$w[nip]){
              echo "<option value=$w[nip] selected>$w[nama]</option>";
            }
            else{
              echo "<option value=$w[nip]>$w[nama]</option>";
            }
          }
		 

    echo "</select>";
			
		
			?>
	   </select> </td>
   
    </tr>
     <tr>
      <td width="79">NPK Mahasiswa</td>
    
      <td width="329"><input type=text name='npk' value="<?php echo $r['npk']; ?>"  size=15> </td>
   
    </tr>
     <tr>
      <td width="79">Judul</td>
    
      <td width="329"><textarea name="judul"  style="width:500px"><?php echo $r['judul']; ?></textarea></td>
   
    </tr>
     <tr>
      <td width="79">IPK</td>
    
      <td width="329"><input type=text  value="<?php echo $r['ipk']; ?>" name='ipk' size=5> </td>
   
    </tr>
     <tr>
      <td width="79">Bidang</td>
    
      <td width="329"><input type=text  value="<?php echo $r['bidang']; ?>" name='bidang' size=14> </td>
   
    </tr>
     <tr>
      <td width="79">Masa Bimbingan</td>
    
      <td width="329">Dari&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="db_tanggal" style="width:50px">
			<?PHP
			$tanggal = 1; #tanggal awal 1
			while ($tanggal!=32){ #ketika value dari $tanggal tidak sama dengan 32 maka lakukan perulangan sampai ke 32
			echo "<option>$tanggal</option>"; #memunculkan tanggal dari 1 - 31
			$tanggal++; #munculkan  tanggal di form
			}
			?>
			</select>
			<select name="db_bulan" style="width:70px">
			<option value="01">Jan</option>
			<option value="02">Feb</option>
			<option value="03">Mar</option>
			<option value="04">Apr</option>
			<option value="05">Mei</option>
			<option value="06">Jun</option>
			<option value="07">Jul</option>
			<option value="08">Ags</option>
			<option value="09">Sep</option>
			<option value="10">Okt</option>
			<option value="11">Nov</option>
			<option value="12">Des</option>
			</select>
			<select name="db_tahun" style="width:72px">
			<?PHP
			$tahun = 2000;
			while ($tahun!=date('Y') + 1){
			echo "<option>$tahun</option>";
			$tahun++;
			}
			?>
	  </select> / <br /> sampai dengan  <select name="sb_tanggal" style="width:50px">
			<?PHP
			$tanggal = 1;
			while ($tanggal!=32){
			echo "<option>$tanggal</option>"; 
			$tanggal++; 
			}
			?>
			</select>
			<select name="sb_bulan" style="width:70px">
			<option value="01">Jan</option>
			<option value="02">Feb</option>
			<option value="03">Mar</option>
			<option value="04">Apr</option>
			<option value="05">Mei</option>
			<option value="06">Jun</option>
			<option value="07">Jul</option>
			<option value="08">Ags</option>
			<option value="09">Sep</option>
			<option value="10">Okt</option>
			<option value="11">Nov</option>
			<option value="12">Des</option>
			</select>
			<select name="sb_tahun" style="width:72px">
			<?PHP
			$tahun = 2000;
			while ($tahun!=date('Y') + 1){
			echo "<option>$tahun</option>";
			$tahun++;
			}
			?>
	  </select></td>
   
    </tr>
    <tr>
      <td>&nbsp;<input type=hidden name='id'  value="<?php echo $r['id_proposal']; ?>" size=4></td>
      <td><input type=submit value=Simpan>
                            <input type=button value=Batal onclick=self.history.back()></td>
     
    </tr>
  </table>
</form>
  
 <?php break; ?>
<?php } ?>